package cn.newjava.book.bean;

import java.util.Date;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * (Borrowing)实体类
 *
 * @author 陈华强
 * @since 2019-10-22 18:54:13
 */
@Data
public class Borrowing implements Serializable {
    private static final long serialVersionUID = 190495236662922890L;

    private Integer id;

    private Integer userId;

    private Integer bookId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date returnTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getReturnTime() {
        long  i = 1000 * 60 * 60 * 24;
        return createTime != null ? new Date(createTime.getTime() + i * 60) : null;
    }
}